<template>
	<view>
		<view class="list">
			<view class="itemflex" v-for="(item,index) in list" :key="index"
			 @click="change(item)">
				<view class="item">
					<view class="item_l">
						<image src="/static/user/q1.png" mode=""></image>
						<view class="tts">
							{{item.question}}
						</view>
					</view>
					<image :style="{transform:item.isopen?'rotate(270deg)':'rotate(90deg)'}" class="img" src="/static/icon/r.png" mode=""></image>
				</view>
				<view class="item1" v-if="item.isopen">
					<image src="/static/user/q2.png" mode=""></image>
					<view class="tts">
						{{item.answer}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		questionList
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				list: [],
				params:{
					pageNum: 1,
					pageSize: 10
				}
			};
		},
		onLoad() {
			this.getlist()
		},
		onReachBottom() {
			this.params.pageNum ++
			this.getlist()
		},
		methods: {
			getlist(){
				questionList(this.params).then(res=>{
					res.rows.forEach(item=>{item.isopen = false})
					this.list.push(...res.rows)
				})
			},
			change(item) {
				item.isopen = !item.isopen
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #FBFBFB;
	}

	.img {
		width: 40rpx;
		height: 40rpx;
		transform: rotate(90deg);
	}

	.itemflex {
		border-bottom: 1rpx solid #eee;
		background: #ffffff;
	}
	.itemflex:last-child{
		border-bottom: none;
	}

	.item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 20rpx 0rpx 0rpx;
		box-sizing: border-box;

		.item_l {
			display: flex;
			align-items: center;

			.tts {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #000000;
			}

			image {
				width: 80rpx;
				height: 80rpx;
			}
		}
	}

	.item1 {
		display: flex;
		padding: 0rpx 20rpx 20rpx 0rpx;
		box-sizing: border-box;

		image {
			width: 80rpx;
			height: 80rpx;
		}

		.tts {
			flex: 1;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #7B7B7B;
			margin-top: 20rpx;
		}
	}
</style>